/****

    activequant - activestocks.eu

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

	
	contact  : contact@activestocks.eu
    homepage : http://www.activestocks.eu

 ****/
package org.activequant.core.domainmodel.options;

import java.io.Serializable;

import org.activequant.core.domainmodel.InstrumentSpecification;

/**
 * 
 * Option box.<br>
 * Holds the following associated variables:
 * <ul>
 * <li>longBox(boolean)</li>
 * <li>lowerCall(InstrumentSpecification)</li>
 * <li>lowerPut(InstrumentSpecification)</li>
 * <li>upperCall(InstrumentSpecification)</li>
 * <li>upperPut(InstrumentSpecification)</li>
 * </ul>
 * <br>
 * <b>History:</b><br>
 * - [20.09.2007] Created (Ulrich Staudinger)<br>
 * - [22.09.2007] Switched to Map<..> and IllegalArgumentException (Erik
 * Nijkamp)<br>
 * 
 * @author Ulrich Staudinger
 */
public class Box implements Serializable {

	private static final long serialVersionUID = 9088941476175607969L;
	/**
	 * private boolean longBox = true;
	 */
	private boolean longBox = true;
	/**
	 * private InstrumentSpecification lowerCall, lowerPut, upperCall, upperPut;
	 */
	private InstrumentSpecification lowerCall, lowerPut, upperCall, upperPut;
	/**
	 * empty Box constructor
	 */
	public Box() {
	}
	/**
	 * constructs a Box using the given longBox(boolean), lowerCall(InstrumentSpecification), lowerPut(InstrumentSpecification), upperCall(InstrumentSpecification) and
	 * upperPut(InstrumentSpecification) to set its associated longBox(boolean), lowerCall(InstrumentSpecification), lowerPut(InstrumentSpecification), upperCall(InstrumentSpecification) and
	 * upperPut(InstrumentSpecification)
	 * @param longBox
	 * @param lowerCall
	 * @param lowerPut
	 * @param upperCall
	 * @param upperPut
	 */
	public Box(boolean longBox, InstrumentSpecification lowerCall, InstrumentSpecification lowerPut, InstrumentSpecification upperCall, InstrumentSpecification upperPut) {
		this.lowerCall = lowerCall;
		this.lowerPut = lowerPut;
		this.upperCall = upperCall;
		this.upperPut = upperPut;
		this.longBox = longBox;
	}
	/**
	 * returns a String in the form:<br/>
	 * "(LONG |SHORT )[${lowerCall.toString}+${lowerPut.toString}+${upperCall.toString}+${upperPut.toString}]"
	 */
	public String toString() {
		return (longBox ? "LONG " : "SHORT ") + "[" + lowerCall.toString() + "+" + lowerPut.toString() + "+" + upperCall.toString() + "+" + upperPut.toString() + "]";
	}
	/**
	 * returns the associated longBox(boolean)
	 * @return
	 */
	public boolean isLongBox() {
		return longBox;
	}
	/**
	 * sets the associated longBox(boolean) with the given longBox(boolean)
	 * @param longBox
	 */
	public void setLongBox(boolean longBox) {
		this.longBox = longBox;
	}
	/**
	 * returns the associated lowerCall(InstrumentSpecification)
	 * @return
	 */
	public InstrumentSpecification getLowerCall() {
		return lowerCall;
	}
	/**
	 * sets the associated lowerCall(InstrumentSpecification) with the given option1(InstrumentSpecification)
	 * @param option1
	 */
	public void setLowerCall(InstrumentSpecification option1) {
		this.lowerCall = option1;
	}
	/**
	 * returns the associated lowerPut(InstrumentSpecification)
	 * @return
	 */
	public InstrumentSpecification getLowerPut() {
		return lowerPut;
	}
	/**
	 * sets the associated lowerPut(InstrumentSpecification) with the given option2(InstrumentSpecification)
	 * @param option2
	 */
	public void setLowerPut(InstrumentSpecification option2) {
		this.lowerPut = option2;
	}
	/**
	 * returns the associated upperCall(InstrumentSpecification)
	 * @return
	 */
	public InstrumentSpecification getUpperCall() {
		return upperCall;
	}
	/**
	 * sets the associated upperCall(InstrumentSpecification) with the given option3(InstrumentSpecification)
	 * @param option3
	 */
	public void setUpperCall(InstrumentSpecification option3) {
		this.upperCall = option3;
	}
	/**
	 * returns the associated upperPut(InstrumentSpecification)
	 * @return
	 */
	public InstrumentSpecification getUpperPut() {
		return upperPut;
	}
	/**
	 * sets the associated upperPut(InstrumentSpecification) with the given option4(InstrumentSpecification)
	 * @param option4
	 */
	public void setUpperPut(InstrumentSpecification option4) {
		this.upperPut = option4;
	}

}
